﻿/*关注页面JS*/
function show_cancel_btn(Num){
	var ID="\#"+"atten"+Num;
	$(ID).css('display','block');
}
function hide_cancel_btn(Num){
	var ID="\#"+"atten"+Num;
	$(ID).css('display','none');
}
/*完成页面JS*/
function show_detelt_btn_Com(Num){
	var ID="\#"+"com"+Num;
	$(ID).show();
}
function hide_detelt_btn_Com(Num){

	var ID="\#"+"com"+Num;
	$(ID).hide();
}
/*已投票页面JS*/
function show_detelt_btn_vote(Num){
	var ID="\#"+"vote"+Num;
	$(ID).show();
}
function hide_detelt_btn_vote(Num){
	var ID="\#"+"vote"+Num;
	$(ID).hide();
}
/*已保存页面JS*/
function show_detelt_btn_save(Num){
	var ID="\#"+"adite_delete"+Num;
	$(ID).show();
}
function hide_detelt_btn_save(Num){
	var ID="\#"+"adite_delete"+Num;
	$(ID).hide();
}


function dele_Complete(id){

if(confirm("真的要删除吗?")){
var $list="\#"+"complete_list_"+id;
$($list).fadeOut(500);


$.ajax({

url:"../person/delete_list.php",
type:"POST",
dataType:"text",
data:"list_id="+id,
success:function (date){
$("#total").html(date);
}

});
}

}


//删除投票
function delete_vote(id){

if(confirm("真的要删除吗?")){
var $list="\#"+"vote"+id;
$($list).fadeOut(500);


$.ajax({

url:"../person/delete_vote.php",
type:"POST",
dataType:"text",
data:"list_id="+id,
success:function (date){
$("#total").html(date);
}

});
}

}

//取消关注
function cancel_attention(friend_id){
	$.ajax({
	url:"cancel_attention.php",
	dataType:"html",
	data:"cancel_id="+friend_id,
	type:"post",
	success:function(data){
		$("#friend"+friend_id).fadeOut();
		var cancel=Number($("#total").html())-1;
		$("#total").text(cancel);

	}
	
});

}

//删除保存
function delete_save(id){

if(confirm("真的要删除吗?")){
var $list="\#"+"save"+id;
$($list).fadeOut(500);


$.ajax({

url:"../person/delete_save.php",
type:"POST",
dataType:"text",
data:"list_id="+id,
success:function (date){
$("#total").html(date);
}

});
}

}



function upload_photo(){

if($(".upload_photo").is(":visible")){
	$(".upload_photo").fadeOut();
}else{
$(".upload_photo").fadeIn();

}

}

function submit_photo(){

	
	$("#photo_form").ajaxForm({
		 url:"upload_photo.php?count=1",  
		 cache:false,
		 dataType: "text",
		success:function(data){
		
		$(".user_photo").find("img").attr("src",data); 
		upload_photo();
		},
		error:function(){
		
		alert("error");
		}
		});

}
